﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FundamentalsOfCompiling
{
    //状态机中的状态
    enum StateType { START, INASSIGN, INRANGE, INCOMMENT, INNUM, INID, INCHAR, DONE }
    // 单词的词法类型 
    public enum LexType
    {
        /* 簿记单词符号 */
        ENDFILE1, ERROR1,
        /* 保留字 */
        PROGRAM, PROCEDURE, TYPE, VAR, IF,
        THEN, ELSE, FI, WHILE, DO,
        ENDWH, BEGIN, END, READ, WRITE,
        ARRAY, OF, RECORD, RETURN,
        INTEGER, CHAR1,
        /* 多字符单词符号 */
        ID, INTC, CHARC,
        /*特殊符号 */
        ASSIGN, EQ, LT, PLUS, MINUS,
        TIMES, OVER, LPAREN, RPAREN, DOT,
        COLON, SEMI, COMMA, LMIDPAREN, RMIDPAREN,
        UNDERANGE,
        //////////////存储换行换行符
        CRT
    }
    //保留字信息
    struct ReservedTable
    {
        public String str; public LexType tok;
        //使用构造函数初始化
        public ReservedTable(string str, LexType tok) { this.str = str; this.tok = tok; }
    }
    /*********** 单词的类型，包括词法信息和语义信息 ************/
    public struct TokenType
    {
        public int lineshow;//记录单词的行号
        public LexType Lex;//语义信息
        public string Sem;//单词信息
    }
    enum NodeKind { ProK, PheadK, DecK, TypeK, VarK, ProcDecK, StmLK, StmtK, ExpK };
    enum DecKind { ArrayK, CharK, IntegerK, RecordK, IdK };
    enum StmtKind { IfK, WhileK, AssignK, ReadK, WriteK, CallK, ReturnK };
    enum ExpKind { OpK, ConstK, VariK };
    enum VarKind { IdV, ArrayMembV, FieldMembV };
    enum ExpType { Void, Integer, Boolean };
    enum ParamType { valparamType, varparamType };

}
